package com.srwl.mytx.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.srwl.mytx.R;
import com.srwl.mytx.utils.Utils;

import java.math.BigDecimal;

import butterknife.BindView;
import butterknife.ButterKnife;

public class TimeAndPriceView extends LinearLayout {
    private String time;
    private BigDecimal price;


    @BindView(R.id.tv_time)
    TextView tv_time;
    @BindView(R.id.tv_price)
    TextView tv_price;

    public TimeAndPriceView(Context context) {
        super(context);
        inflate(context, R.layout.time_ane_price_view_layout, this);
        ButterKnife.bind(this);
    }

    public TimeAndPriceView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        inflate(context, R.layout.time_ane_price_view_layout, this);
        ButterKnife.bind(this);
    }

    public TimeAndPriceView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        inflate(context, R.layout.time_ane_price_view_layout, this);
        ButterKnife.bind(this);
    }

    public void init(String time, BigDecimal price) {
        tv_time.setText(time);
        tv_price.setText(Utils.moneyFormat(price));
    }

}
